// core
import { createApp } from "vue"
import App from "@/App.vue"
import store from "@/store"
import router from "@/router"
import "@/router/permission"
import loadMore from "@/utils/lazyLoad"
// @ts-expect-error
import horizontalScroll from "el-table-horizontal-scroll"
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from "@/utils/ruoyi"
import {
  Button,
  Form,
  Field,
  Cell,
  CellGroup,
  Uploader,
  Popup,
  Loading,
  Cascader,
  Empty,
  Tab,
  Tabs,
  Toast,
  Checkbox,
  List,
  Icon,
  Overlay,
  Dialog,
  PullRefresh,
  Card,
  Swipe,
  SwipeItem,
  Notify,
  Search,
  RadioGroup,
  Radio,
  Picker,
  Image as VanImage,
  Highlight,
  DatePicker,
  PickerGroup,
  Lazyload
} from "vant"
import { QuillEditor } from "@vueup/vue-quill"
// load
import { loadSvg } from "@/icons"
import { loadPlugins } from "@/plugins"
import { loadDirectives } from "@/directives"
// css
import "uno.css"
import "normalize.css"
import "element-plus/dist/index.css"
import "element-plus/theme-chalk/dark/css-vars.css"
import "vxe-table/lib/style.css"
import "vxe-table-plugin-element/dist/style.css"
import "@/styles/index.scss"
import "vant/lib/index.css"
import "@vueup/vue-quill/dist/vue-quill.snow.css"
//引入第三方字体样式
import "@/assets/icon-font/common.css"
import "@/assets/icon-font/iconfont.css"
// 引入 eCharts
import * as echarts from "echarts"

const app = createApp(App)
app.config.globalProperties.$echarts = echarts
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
/** 加载插件 */
loadPlugins(app)
/** 加载全局 SVG */
loadSvg(app)
/** 加载自定义指令 */
loadDirectives(app)
app.component("QuillEditor", QuillEditor)
app.use(store).use(router).directive("loadMore", loadMore)
app
  .use(Uploader)
  .use(Button)
  .use(Form)
  .use(Field)
  .use(Cell)
  .use(CellGroup)
  .use(Popup)
  .use(Cascader)
  .use(Toast)
  .use(Checkbox)
  .use(List)
  .use(Icon)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(VanImage)
  .use(PullRefresh)
  .use(Card)
  .use(Swipe)
  .use(SwipeItem)
  .use(Notify)
  .use(Highlight)
  .use(Empty)
  .use(Search)
  .use(Tab)
  .use(Tabs)
  .use(Radio)
  .use(RadioGroup)
  .use(Picker)
  .use(Lazyload)
  .use(DatePicker)
  .use(PickerGroup)
  .use(horizontalScroll)
router.isReady().then(() => {
  app.mount("#app")
})
